home *** CD-ROM | disk | FTP | other *** search
-
- function units_stransport_setup()
- units_setup_sea(4,false,true,ENET_EFFECT_GEOMETRY_SEATRANSPORTSHADOW)
- end
-
- function units_stransport_resetup()
- units_setup_sea(4,false,false,ENET_EFFECT_GEOMETRY_SEATRANSPORTSHADOW)
- end
-
- function units_stransport_select()
- units_select(22)
- end
-
- function units_stransport_unselect()
- units_unselect()
- end
-
- function units_stransport_selectenemy()
- uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
- end
-
- function units_stransport_damaged()
- uniGetExecutor():applyDamage(uniGetLife())
- end
-
- function units_stransport_highlight()
- uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
- end
-
- function units_stransport_explode()
- units_explode_water2()
- end
-
- function units_stransport_move()
- local unit = uniGetExecutor()
- local sound = unit:play3DSound("seatransport_move.wav",1)
- local steps = unit:addSimpleEffect(ENET_EFFECT_PS_SEATRANSPORT_WATERTRAY)
- waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 0.7))
- waitDeath(unit:addMoveEffect(ENET_EFFECT_MOVE_LINEAR,80))
- steps:suspendedDestroy(1.0)
- sound:destroy()
- end
-
- function units_stransport_fire()
- end
-
- function units_stransport_load()
- local unit = uniGetExecutor()
- local cargo = uniGetTarget()
- units_waitCommandByUID(cargo,unit:getCurrentCommandUID() - 1)
- waitDeath(unit:parabolicTargetting(cargo))
- unit:addAnimationToQueue(ENAT_PREPAREFORFIRE1,1)
- unit:addAnimationToQueue(ENAT_FIREPOSITION1,MATH_INFINITY)
- unit:addAnimationToQueue(ENAT_AFTERFIRE1,1)
- cargo:setVisibility(true,false)
- uniSetPosition(unit:getBone(ENBT_FIRE1):getWorldPosition())
- units_load_shrink(cargo)
- local ground = units_addGround(unit,ENET_STRANSPORT_GROUND)
- local movecmd_uid = cargo:executeCommand(ENC_MOVE,true)
- cargo:terminateCommand()
- cargo:executeCommand(ENC_INSIDE,true)
- while(cargo:getCurrentCommandUID() == movecmd_uid) do pause() end
- cargo:setTransformOwner(units_findfreefirespot(unit,1))
- unit:setCurrentAnimationRepeatCount(0)
- cargo:setVisibility(false,false)
- cargo:terminateCommand()
- end
-
- function units_stransport_unload()
- local unit = uniGetExecutor()
- local cargo = uniGetTarget()
- units_waitCommandByUID(cargo,unit:getCurrentCommandUID() - 1)
- local pos = uniGetPosition()
- waitDeath(unit:parabolicTargetting(pos))
- unit:addAnimationToQueue(ENAT_PREPAREFORFIRE1,1)
- unit:addAnimationToQueue(ENAT_FIREPOSITION1,MATH_INFINITY)
- unit:addAnimationToQueue(ENAT_AFTERFIRE1,1)
- local ground = units_addGround(unit,ENET_STRANSPORT_GROUND)
- cargo:setLocalOrientation(0,1,0,0,0,-1)
- cargo:setTransformOwner()
- cargo:setScale(0.4,0.4,0.4)
- cargo:setVisibility(true,false)
- local movecmd_uid = cargo:executeCommand(ENC_MOVE,true)
- cargo:terminateCommand()
- cargo:executeCommand(ENC_INSIDE,true)
- while(cargo:getCurrentCommandUID() == movecmd_uid) do pause() end
- units_unload_growth(cargo)
- cargo:setVisibility(true,true)
- unit:setCurrentAnimationRepeatCount(0)
- cargo:terminateCommand()
- end
-
- function units_stransport_transfer()
- local unit = uniGetExecutor()
- local cargo = uniGetTarget()
- units_waitCommandByUID(cargo,unit:getCurrentCommandUID() - 1)
- local from = cargo:getTransformOwner():getTransformOwner()
- local fromType = from:getEffectType()
- units_waitCommandByUID(from,unit:getCurrentCommandUID() - 2)
- if(fromType == ENET_UNIT_PLATFORM) then
- waitDeath(from:parabolicTargetting(unit))
- from:addAnimationToQueue(ENAT_IDLETIMEOUT1,1)
- from:addAnimationToQueue(ENAT_FIREPOSITION1,MATH_INFINITY)
- from:addAnimationToQueue(ENAT_IDLETIMEOUT2,1)
- local ground = units_addGround(from,ENET_PLATFORM_GROUND)
- cargo:setTransformOwner()
- units_stransport_load()
- from:setCurrentAnimationRepeatCount(0)
- from:terminateCommand()
- elseif(fromType == ENET_UNIT_LANDTRANSPORT or fromType == ENET_UNIT_SEATRANSPORT) then
- waitDeath(from:parabolicTargetting(unit))
- from:addAnimationToQueue(ENAT_PREPAREFORFIRE1,1)
- from:addAnimationToQueue(ENAT_FIREPOSITION1,MATH_INFINITY)
- from:addAnimationToQueue(ENAT_AFTERFIRE1,1)
- local g_type = ENET_STRANSPORT_GROUND
- if(fromType == ENET_UNIT_LANDTRANSPORT) then g_type = ENET_LTRANSPORT_GROUND end
- local ground = units_addGround(from,g_type)
- cargo:setLocalOrientation(0,1,0,0,0,-1)
- cargo:setTransformOwner()
- cargo:setScale(0.4,0.4,0.4)
- units_stransport_load()
- from:setCurrentAnimationRepeatCount(0)
- from:terminateCommand()
- elseif(fromType == ENET_UNIT_TRANSCHOPPER_HUMAN) then
- waitDeath(from:parabolicTargetting(unit))
- cargo:setTransformOwner()
- units_stransport_load()
- from:setCurrentAnimationRepeatCount(0)
- from:terminateCommand()
- else
- consoleWrite("attempt to reload from unknown transport type!!!")
- end
- end
-
- registerCommand(ENSCRIPTSET_SEATRANSPORT,ENC_MOVE,"units_stransport_move")
- registerCommand(ENSCRIPTSET_SEATRANSPORT,ENC_FIRE1,"units_stransport_fire")
- registerCommand(ENSCRIPTSET_SEATRANSPORT,ENC_FIRE2,"units_stransport_fire")
- registerCommand(ENSCRIPTSET_SEATRANSPORT,ENC_SELECT,"units_stransport_select")
- registerCommand(ENSCRIPTSET_SEATRANSPORT,ENC_SELECTENEMY,"units_stransport_selectenemy")
- registerCommand(ENSCRIPTSET_SEATRANSPORT,ENC_UNSELECT,"units_stransport_unselect")
- registerCommand(ENSCRIPTSET_SEATRANSPORT,ENC_SETUP,"units_stransport_setup")
- registerCommand(ENSCRIPTSET_SEATRANSPORT,ENC_RESETUP,"units_stransport_resetup")
- registerCommand(ENSCRIPTSET_SEATRANSPORT,ENC_DAMAGED,"units_stransport_damaged")
- registerCommand(ENSCRIPTSET_SEATRANSPORT,ENC_EXPLODE,"units_stransport_explode")
- registerCommand(ENSCRIPTSET_SEATRANSPORT,ENC_HIGHLIGHT,"units_stransport_highlight")
- registerCommand(ENSCRIPTSET_SEATRANSPORT,ENC_TRANSFER,"units_stransport_transfer")
- registerCommand(ENSCRIPTSET_SEATRANSPORT,ENC_LOAD,"units_stransport_load")
- registerCommand(ENSCRIPTSET_SEATRANSPORT,ENC_UNLOAD,"units_stransport_unload")
- registerCommand(ENSCRIPTSET_SEATRANSPORT,ENC_INSIDE,"units_inside")
-
- -- make description of unit
- desc = getEffectDescriptionP(ENET_UNIT_SEATRANSPORT)
- desc.ClassID = ENCLASS_MESHINSTANCE
- desc.EffectClassType = ENECT_GEOMETRY
- desc.FileName = "seatransport.rmd"
- desc.ScriptSet = ENSCRIPTSET_SEATRANSPORT
- desc.MoveType = ENMOVE_SWIM
- desc.RenderType = ENRENDERTYPE_GEOMETRY
- desc.Material = ENMAT_RIGIDSKINNEDMESH
- desc.MaterialColors = units_materialcolors_human
- desc.isPlacesVisible = false
-
- -- shadow
- desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_SEATRANSPORTSHADOW)
- desc.ClassID = ENCLASS_MESHINSTANCE
- desc.EffectClassType = ENECT_GEOMETRY
- desc.FileName = "seatransport_shadow.rmd"
- desc.RenderType = ENRENDERTYPE_SHADOW
- desc.Material = ENMAT_SHADOW
- desc.MaterialColors = units_materialcolors_shadow
-
- -- register new unit to logic
- unitDesc = logic_getUnitDescP(10)
- unitDesc.group = 1
- unitDesc.order = 10
- unitDesc.unit_res_id = ENET_UNIT_SEATRANSPORT
- unitDesc.unit_icon_id = "Seatransport_h_small_normal.dds"
- unitDesc.active_id = "Seatransport_h_small_active.dds"
- unitDesc.pressed_id = "Seatransport_h_small_pressed.dds"
- unitDesc.big_icon_id = "Seatransport_h_big_normal.dds"
- unitDesc.small_icon_id = "Seatransport_u_stats.dds"
- unitDesc.HP = 4
- unitDesc.MP = 60
- unitDesc.WR = 0
- unitDesc.min_WR = 0
- unitDesc.WD = 0
- unitDesc.WR2 = 0
- unitDesc.min_WR2 = 0
- unitDesc.WD2 = 0
- unitDesc.ability = 3
- unitDesc.transport = 4
- unitDesc.value = 2
- unitDesc.race = 0
- unitDesc.fire_pause = 1.0
- unitDesc.move_pause = 3.0
- unitDesc.unit_info_scale = 0.04
- unitDesc.scn_name = "NTRANSP"
-
-
-
-
- ------------------------------------------------------------------------------------------
- ------------------------------------------------------------------------------------------
- ------------------------------------------------------------------------------------------
- desc = getEffectDescription(ENET_EFFECT_GEOMETRY_VEGETATION_FURPALM)
- desc.FileName = "stransport_ground.smd"
- desc.effectUsageType = ENEUT_GENERIC
- desc.Geometry.isCollisionable = true
- changeEffect(ENET_STRANSPORT_GROUND,desc)
-